package org.droidcon.apps.template.ui.widget;

/*
 * Copyright 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.droidcon.apps.template.R;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;

/**
 * Custom view that draws a vertical time "ruler" representing the chronological
 * progression of a single day. Usually shown along with {@link BlockView}
 * instances to give a spatial sense of time.
 */
public class StyledTimeRulerView extends TimeRulerView {

	public StyledTimeRulerView(Context context) {
		this(context, null);
	}

	public StyledTimeRulerView(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public StyledTimeRulerView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);

		final TypedArray a = context.obtainStyledAttributes(attrs,
				R.styleable.TimeRulerView, defStyle, 0);

		mHeaderWidth = a.getDimensionPixelSize(
				R.styleable.TimeRulerView_headerWidth, mHeaderWidth);
		mHourHeight = a.getDimensionPixelSize(
				R.styleable.TimeRulerView_hourHeight, mHourHeight);
		mHorizontalDivider = a
				.getBoolean(R.styleable.TimeRulerView_horizontalDivider,
						mHorizontalDivider);
		mLabelTextSize = a.getDimensionPixelSize(
				R.styleable.TimeRulerView_labelTextSize, mLabelTextSize);
		mLabelPaddingLeft = a.getDimensionPixelSize(
				R.styleable.TimeRulerView_labelPaddingLeft, mLabelPaddingLeft);
		mLabelColor = a.getColor(R.styleable.TimeRulerView_labelColor,
				mLabelColor);
		mDividerColor = a.getColor(R.styleable.TimeRulerView_dividerColor,
				mDividerColor);
		mStartHour = a.getInt(R.styleable.TimeRulerView_startHour, mStartHour);
		mEndHour = a.getInt(R.styleable.TimeRulerView_endHour, mEndHour);

		a.recycle();
	}
}
